import { createRouter, createWebHashHistory } from 'vue-router';

const routes = [
  {
    path: '/',
    name: 'main',
    component: () => import('../pages/Main.vue'),
    redirect: '/home',
    children: [
      {
        name: 'home',
        path: '/home',
        component: () => import('../pages/Home.vue'),
      },
      {
        name: 'taskSelect',
        path: '/task/taskSelect',
        component: () => import('../pages/task/taskSelect.vue'),
      },
      {
        name: 'taskCheck',
        path: '/task/taskCheck',
        component: () => import('../pages/task/taskCheck.vue'),
      },
      {
        name: 'volunteerContorl',
        path: '/userContorl/volunteer',
        component: () => import('../pages/userControl/volunteer.vue'),
      },
      {
        name: 'elderlyContorl',
        path: '/userContorl/elderly',
        component: () => import('../pages/userControl/elderly.vue'),
      },
      {
        name: 'notifyAdd',
        path: '/Notify/addNotify',
        component: () => import('../pages/notify/addNotify.vue'),
      },
      {
        name: 'notifyLook',
        path: '/Notify/selectNotify',
        component: () => import('../pages/notify/selectNotify.vue'),
      },
      // 数据分析子页面
      {
        name: 'elderlyAnalyze',
        path: '/DataAnalyze/elderlyAnalyze',
        component: () => import('../pages/dataAnalyze/elderlyAnalyze.vue'),
      },
      {
        name: 'volunteerAnalyze',
        path: '/DataAnalyze/volunteerAnalyze',
        component: () => import('../pages/dataAnalyze/volunteerAnalyze.vue'),
      },
      {
        name: 'taskAnalyze',
        path: '/DataAnalyze/taskAnalyze',
        component: () => import('../pages/dataAnalyze/TaskAnalyze.vue'),
      },
    ],
  },
  {
    path: '/user',
    name: 'person',
    component: () => import('../pages/admin/person.vue'),
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
